<!-- Breadcrums -->
<div class="container">
	<ul id="breadcrumbs">
	<?php foreach ($breadcrumbs as $key => $breadcrumb) { ?>
	<?php if($key == 0) {  ?>
		<li><a href="<?php echo $breadcrumb['href']; ?>"><i class="icon-home"></i></a></li>
		<?php } else { ?>
		<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
		<?php } ?>
		<?php } ?>
	</ul>
</div>
<!-- Breadcrum -->
<div class="container">
	<div id="main">
		<div class="row">
			<div class="span12">
				<div class="tabbable tabbable-bordered property-detail-listing">
					<div class="property property-detail">
						<div class="review">
							<div class="share"><!-- AddThis Button BEGIN -->
								<div class="addthis_default_style">
									<a class="addthis_button_facebook"></a> 
									<a class="addthis_button_twitter"></a>
									<a class="addthis_button_email"></a>
									<a class="addthis_button_print"></a>
								</div>
								<script type="text/javascript"
									src="//s7.addthis.com/js/250/addthis_widget.js"></script> <!-- AddThis Button END -->
							</div>
						</div>
						<div class="clearfix"></div>
						<h1 class="page-header page-header-listing-detail"><?php echo $listingtoview['ProjectName']; ?></h1>
						<?php
						$listingtoview['media'] = $this->mdl_listingmapmodel->get_media($listingtoview['Listing_ID'], "Gallery", 20);
						?>
					
						<?php
						$preview = "";
						$thumb = "";
						if(isset($listingtoview['media']) && is_array($listingtoview['media']) && count($listingtoview['media']) > 0) {
							foreach ($listingtoview['media'] as $key => $img) {
								if ($key == 0) {
									$preview = $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listingtoview['Listing_ID'] . '/' . str_replace(' ', '%20', $img->FileName . '-870x420' . $img->FileExtension);
									//get thumb for property map
									$thumb = $this->imagemodel->resize($img->FileName . $img->FileExtension, THUMB_IMAGE_WIDTH, THUMB_IMAGE_HEIGHT, HTTP_PROJECT_LISTING_IMAGE . $listingtoview['Listing_ID'] . '/', $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listingtoview['Listing_ID'] . '/');
									break;
								}
							}
						}
						?> 
					
						<?php 
						$listingtoview['media'] = $this->mdl_listingmapmodel->get_media($listingtoview['Listing_ID'], "Gallery", 20);
						?>
						<?php if(isset($listingtoview['media']) && is_array($listingtoview['media']) && count($listingtoview['media']) > 0) { ?>
						<div id="main-slider" class="flexslider" style="margin-bottom: 0px;">
					
						  	<ul class="slides">						  
								<?php foreach ($listingtoview['media'] as $key => $img) { ?>
								<li <?php if ($key == 0) { echo 'class="flex-active-slide"'; } ?>>
								<img src="<?php echo $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listingtoview['Listing_ID'] . '/' . str_replace(' ', '%20', $img->FileName . '-870x420' . $img->FileExtension); ?>" alt="<?php echo $listingtoview['ProjectName']; ?>" />
								</li>
								<?php } ?>
							</ul>
						  
						</div>
						<?php } ?>
						<!-- /.carousel -->
						<div class="row-fluid">
							<?php if($listingtoview['Price_Min'] > 0) { ?>
							<div class="span4 line">
							</div>
							<div class="span4">
								<div class="price">
									<h1 class="boxtitle page-header text-center">
									<?php echo $listingtoview['PriceUnit'] . " " . number_format(($listingtoview['Price_Min']), 0, '.', ','); ?>
									</h1>
								</div>
							</div>
							<div class="span4 line">
							</div>
							<?php } else { ?>
							<div class="span3">
								<hr/>
							</div>
							<div class="span6">
								<div class="price">
									<h1 class="boxtitle page-header text-center">Price On Application</h1>
								</div>
							</div>
							<div class="span3">
								<hr/>
							</div>
							<?php } ?>
						</div>
					</div>
					<div class="property-detail properties-rows">
						<div class="row-fluid">
							<div class="span4">
								<div class="row-fluid">
									<?php
										$price_usd = $listingtoview['Price_Min'] * IDR_TO_USD;
										$price_usd_formatted = USD_UNIT . " " . number_format(($listingtoview['Price_Min'] * IDR_TO_USD), 0, '.', ',');
										//$price_converted_int = $this->helpermodel->price_converttobase(trim($listingtoview['Price_Min']), USD_UNIT);
									?>
									<?php if(!empty($listingtoview['Price_Min']) && $listingtoview['Price_Min'] > 0) { ?>
									<div class="pull-left span8 spanusd sepH_a">
										Estimated <?php echo $price_usd_formatted; ?>
									</div>
									<div class="pull-right span4">
										<select name="curencyid" class="curencyid_ajax span12">
											<option value="AUD">AUD</option>
											<option value="CNY">CNY</option>
											<option value="EUR">EUR</option>
											<option value="GBP">GBP</option>
											<option value="HKD">HKD</option>
											<option value="IDR">IDR</option>
											<option value="INR">INR</option>
											<option value="JPY">JPY</option>
											<option value="NZD">NZD</option>
											<option value="SGD">SGD</option>
											<option value="THB">THB</option>
											<option value="USD" selected="selected">USD</option>
											<option value="VND">VND</option>
										</select>
									</div>
									<span class="price asking_price_local_int" style="visibility: hidden;with:0px;height: 0px;position: absolute">
										<?php echo $listingtoview['PriceUnit'] . " " . number_format(($listingtoview['Price_Min']), 0, '.', ','); ?>
				                    </span>
									<span class="price_usd" style="visibility: hidden;with:0px;height: 0px;position: absolute"><?php echo trim($price_usd); ?>
				                   	</span>
				                   	<span class="unit_price" style="visibility: hidden;with:0px;height: 0px;position: absolute"><?php echo $listingtoview['PriceUnit']; ?></span>
				                   	<?php } ?>
								</div>
								<div class="row-fluid">
									<p>
										<span><strong>(Guide Price)</strong></span><br/>
										<span>Lised on <?php echo date('F j, Y', strtotime($listingtoview['ListedOnUtc'])); ?></span>
									</p>
								</div>
								<div class="row-fluid" id="contactAgent">
									<div class="controls">
										<input type="submit" value="Property Information" id="" class="btn btn-primary btn-large">
										<button type="submit" class="btn btn-primary btn-large contact-form" data-toggle="modal" data-target="#myModal">Contact</button>
									</div>
									<div class="widget widget-listing our-agents w-box-content-2">
										<?php if($agentInfo) { ?>
										<div class="content">
											<div class="agent" style="border: 0px none;box-shadow:0 0 0 rgba(0, 0, 0, 0)">
												<div class="image">
													<?php if($agentInfo['AgentPhoto']) { ?>
														<img src="<?php echo $agentInfo['AgentPhoto']; ?>" alt="<?php echo $agentInfo['Name']; ?>">
													<?php } else { ?>
														<img src="<?php echo $this->config->item('HTTP_AGENTS_MEDIA_IMAGE'); ?>no-image.png" alt="">
													<?php } ?>
													
												</div>
												<div class="clearfix"></div>
												<!-- /.image -->
												<div class="name"><strong><?php echo strtoupper($agentInfo['Name']); ?></strong></div>
												<!-- /.name -->
												<div class="phone">
													<span class="muted">Mobile:</span> <strong><?php if(isset($agentInfo['Mobile'])){echo $agentInfo['Mobile'];} ?></strong>
												</div>
												<!-- /.phone -->
												<div class="email">
													<a href="mailto:<?php if(isset($agentInfo['Email'])) { echo $agentInfo['Email'];} else {echo "agent@jllresidential.com";} ?>"><strong><?php if(isset($agentInfo['Email'])) { echo $agentInfo['Email'];} else {echo "agent@jllresidential.com";} ?></strong></a>
												</div>
												<!-- /.email -->
												<div class="clearfix"></div>
											</div>
										<!-- /.agent -->
										</div>
									<!-- /.content --> <?php } ?>
									</div>
									<!-- /.our-agents -->
									<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
										<form action="" id="validate_field_contact_agent_detail_listing" class="button-contact-agent-detail-listing">
											<div class="modal-header">
											  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
											  <input type="hidden" name="agent_email" value="<?php echo $agentInfo['Email']; ?>" >
											  <input type="hidden" name="listing_id" value="<?php echo $listingtoview['Listing_ID']; ?>" >
											  <input type="hidden" name="listing_name" value="<?php echo $listingtoview['ProjectName']; ?>" >
												<input type="hidden" name="action" value="sendenquiry" />
											  <h3 id="myModalLabel">Contact this Agent</h3>
											  <div id="message_notification"></div>
											</div>
											<div class="modal-body">
												<div class="content">
													<div class="row-fluid">
											  			<div class="image span4">
											  				<?php if($agentInfo['AgentPhoto']) { ?>
															<img src="<?php echo $agentInfo['AgentPhoto']; ?>" alt="<?php echo $agentInfo['Name']; ?>">
															<?php } else { ?>
															<img src="<?php echo $this->config->item('HTTP_AGENTS_MEDIA_IMAGE'); ?>no-image.png" alt="">
															<?php } ?>
											  			</div>
											  			<div class="body span8">
											  				<h3><?php echo $agentInfo['Name']; ?></h3>
											  				<h5><a><?php echo $agentInfo['Mobile']; ?></a></h5>
											  			</div>
											  		</div>
										  			<div class="row-fluid">
										  				<div class="span4">
										  					<input type="text" name="name" id="name" class="span12" maxlength="20" placeholder="Name">
										  				</div>
										  				<div class="span4">
										  					<input type="text" name="phone" id="phone" class="span12" maxlength="20" placeholder="Phone">
										  				</div>
										  				<div class="span4">
										  					<input type="text" name="email" id="email" class="span12" placeholder="Email">
										  				</div>
										  			</div>
										  			<div class="row-fluid">
										  				<textarea class="span12" name="agent_message" id="agent_message" cols="70" rows="3"><?php echo $agentInfo['Name']; ?>, I saw your profile on Indonesia Residential. I'd like to schedule time for us to talk. Please reply to this email if you are interested.</textarea>
										  			</div>
												</div>
											</div>
											<div class="modal-footer">
											  <input type="submit" value="Send" id="" class="btn btn-primary">
											</div>
										</form>
									</div>
								</div>
							</div>
							<div class="span8">
								<div class="w-box-content cnt_a" style="border: 0px none;">
									<p class="sepH_a"><strong>Details</strong></p>
									<div class="row-fluid">
										<ul class="span5">
											<li class="">
												<?php 
													//get Tenure Name by Id
												$tenureObj = $this->lookupmodel->getTenure($this->config->item('config_language_id'), $this->config->item('market'), $listingtoview['Listing_ID']);
												$tenureName = isset($tenureObj->Name) ? $tenureObj->Name : "";
												?>
												<?php echo $listingtoview['PropertyType'] ?>
											</li>
											<li class="">
												<?php if($listingtoview['Price_Min'] > 0) { ?> 
													<?php if($listingtoview['Size_Min'] > 0) { ?>
														<?php echo $listingtoview['PriceUnit'] . " " . number_format(($listingtoview['Price_Min']/$listingtoview['Size_Min']), 0, '.', ','); ?> PSF
													<?php } else { ?>
														<?php if($listingtoview['ListingType'] == "land" && $listingtoview['LandArea'] > 0) { ?>
														<?php echo $listingtoview['PriceUnit'] . " " . number_format(($listingtoview['Price_Min']/$listingtoview['LandArea']), 0, '.', ','); ?> PSF
														<?php } else { ?>
															<?php echo "Price On Application"; ?>
														<?php } ?>
													<?php } ?>
												<?php } else { ?> 
													<?php echo "Price On Application"; ?> 
												<?php } ?>
											</li>
										</ul>
										<ul class="span4">
											<li class="">
												<?php if($listingtoview['ListingType'] == "land" && isset($listingtoview['LandArea']) && $listingtoview['LandArea'] > 0) { ?>
												<?php echo number_format($listingtoview['LandArea']) . ' ' . $listingtoview['SizeUnit']; ?>
												<?php } else { ?>
												<?php echo number_format($listingtoview['Size_Min']) . ' ' . $listingtoview['SizeUnit']; ?>
												<?php } ?>
											</li>
											<li class="">
												<?php echo $tenureName; ?>
											</li>
										</ul>
										<ul class="span3 property" style="border: 0px none;box-shadow: 0 0 0 rgba(0, 0, 0, 0);">
											<div class="control-group">
												<div class="controls">
													<div class="bedrooms sepH_b">
														<div class="content"><?php echo $listingtoview['Bedroom']; ?></div>
													</div>
													<div class="bathrooms sepH_b">
														<div class="content"><?php echo $listingtoview['Bathroom']; ?></div>
													</div>
												</div>
											</div>
										</ul>
									</div>
								</div>
								<div class="row-fluid">
									<div class="clearfix"></div>
									<div class="w-box-content-2">
										<p class="sepH_a page-header-a"><strong>Overview</strong></p>
										<div class="description">
											<p><?php
											echo html_entity_decode($listingtoview['Description'], ENT_QUOTES, 'UTF-8');
											?></p>
										</div>
										<div class="clearfix"></div>
										<?php if($features && $Facilities) { ?>
										<div class="row-fluid">
											<div class="span4">
												<div class="jll-box-header">
													<h3 class="infohead"><?php echo $text_features; ?></h3>
												</div>
												<ul class="span4">
												<?php foreach ($features as $feature) { ?>
													<li class="checked"><?php echo $feature['Name']; ?></li>
													<?php } ?>
												</ul>
											</div>
											<div class="span6">
												<div class="jll-box-header">
													<h3 class="infohead"><?php echo $text_facilities; ?></h3>
												</div>
												<ul class="span8">
												<?php foreach ($Facilities as $facility) { ?>
													<li class="checked"><?php echo $facility['Name']; ?></li>
													<?php } ?>
												</ul>
											</div>
										</div>
										<?php } else { ?>
										<?php if($features) { ?>
										<div class="row-fluid">
											<div class="span4">
												<div class="jll-box-header">
													<h3 class="infohead"><?php echo $text_features; ?></h3>
												</div>
												<ul class="span4">
												<?php foreach ($features as $feature) { ?>
													<li class="checked"><?php echo $feature['Name']; ?></li>
													<?php } ?>
												</ul>
											</div>
										</div>
										<?php } ?>
										<?php if($Facilities) { ?>
										<div class="row-fluid">
											<div class="span6">
												<div class="jll-box-header">
													<h3 class="infohead"><?php echo $text_facilities; ?></h3>
												</div>
												<ul class="span8">
												<?php foreach ($Facilities as $facility) { ?>
													<li class="checked"><?php echo $facility['Name']; ?></li>
													<?php } ?>
												</ul>
											</div>
										</div>
										<?php } ?>
										<?php } ?> 
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="w-box-content-2">
						<?php echo html_entity_decode($disclaimer->Content, ENT_QUOTES, 'UTF-8'); ?>
					</div>
					<div class="property-detail">
						<h3 class="infohead">Map</h3>
						<input type="hidden" id="latListing" value="<?php echo $listingtoview['Latitude']; ?>" /> 
						<input type="hidden" id="lngListing" value="<?php echo $listingtoview['Longitude']; ?>" />
						<input type="hidden" id="priceListing" value="<?php if($listingtoview['Price_Min'] > 0) { ?> <?php echo $listingtoview['PriceUnit'] . " " . number_format(($listingtoview['Price_Min']), 0, '.', ','); ?> <?php } else { ?> <?php echo "Price On Application"; ?> <?php } ?>" />
						<input type="hidden" id="areaListing" value="<?php echo number_format($listingtoview['Size_Min']) . ' ' . $listingtoview['SizeUnit']; ?>" />
						<input type="hidden" id="thumbListing" value="<?php echo $thumb; ?>" />
						<input type="hidden" id="titleListing" value="<?php echo $listingtoview['ProjectName']; ?>" />
						<div id="property-map"></div>
					<!-- /#property-map -->
					</div>
			</div>
		</div>
		<?php //$this->load->view('helpers/widgets/contact.php'); ?> 
		</div>
	</div>
</div>
